[PyTorch/Jax] Fix attention mask definition, and sliding window for decoder - #818
Conversation
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
For reference, most frameworks treat attention mask
|
|
@timmoon10 thanks for the table 😺 I was doing something like that myself (OCD? not if someone else is also doing it!). After looking through some of the other frameworks' implementations (PyTorch/Jax/Paddle), and our own implementation and unit tests, I'm leaning towards I don't think Keras is a popular framework now and that we should follow its trend. Also, PyTorch's Our fused softmax implementation uses Any thoughts? 😃 thanks! |
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
…ntation and mask generation in unit tests Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
/te-ci |
|
Hi @cyanguwa, thanks for making things clear. TE-JAX awares mask_bit = |
|
@cyanguwa Thank you so much for looking into this and clarifying the mask definition ❤️ |
Signed-off-by: cyanguwa <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
/te-ci pytorch |
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
/te-ci jax |
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
/te-ci pytorch |
|
/te-ci jax |
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
Signed-off-by: Charlene Yang <8636796+cyanguwa@users.noreply.github.com>
|
/te-ci pytorch |
Description
Fixes #614.
Fixes #629.
Moving forward, we'd like to define attention mask consistently in PyTorch, Jax and Paddle as
Truebeing masking out the corresponding position andFalsebeing allowing that position to participate in attention. A typical causal mask would look like:Type of change
Changes
aux_ctx_tensorsand similar tensors usingsave_for_backwardcall instead of toctxChecklist: